﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ProjectChords.Services.API
{
    public interface IGenericCRUDService<T>
    {
        /// <summary>
        /// Loads object T from the given unique identifier
        /// </summary>
        /// <param name="id">Unique identifier for object T</param>
        T LoadFromId(string id);

        /// <summary>
        /// Adds object T against given unique identifier
        /// </summary>
        /// <param name="id">Unique identifier for obj</param>
        /// <param name="obj">Object of type T</param>
        void Add(string id, T obj);

        /// <summary>
        /// Updates an existing object with the unique identifier "id" with the given value obj.
        /// </summary>
        /// <param name="id">Unique id of an existing object</param>
        /// <param name="obj">New/Updated object to be stored against id</param>
        void Update(string id, T obj);

        /// <summary>
        /// Deletes the object that is stored against unique identifier "id"
        /// </summary>
        /// <param name="id">The unique identifier of the existing object that needs to be deleted.</param>
        void Delete(string id);

        /// <summary>
        /// Returns all available objects of type T.
        /// </summary>
        /// <returns>List of all existing objects of the given type</returns>
        List<T> GetAll();

        /// <summary>
        /// Clears (deletes) all existing objects
        /// </summary>
        void ClearAll();
    }
}
